package universityModel.utils;

/**
 *
 * @author Parkhomenko Dmytro
 */

public interface AdvancedArray<E> {
    int size();

    boolean isEmpty();

    /**
     * Returns an array containing all of the elements in this list in proper
     * sequence (from first to last element).
     * <p/>
     * <p>The returned array will be "safe" in that no references to it are
     * maintained by this list.  (In other words, this method must
     * allocate a new array even if this list is backed by an array).
     * The caller is thus free to modify the returned array.
     * <p/>
     * <p/>
     * * @return Collection represented as array of Object.
     */
    Object[] toArray();

    /**
     * Appends the specified element to the end of this list.
     *
     * @param e element to be appended to this list
     * @return <tt>true</tt>
     * @throws NullPointerException if the specified element is null and this
     *                              list does not permit null elements
     */
    boolean add(E e);

    /**
     * Returns the element at the specified position in this list.
     *
     * @param index index of the element to return
     * @return the element at the specified position in this list
     * @throws IndexOutOfBoundsException if the index is out of range
     *                                   (<tt>index &lt; 0 || index &gt;= size()</tt>)
     */
    E get(int index);

    /**
     * Removes the element at the specified position in this list.
     * Shifts any subsequent elements to the left.
     * Returns the element that was removed from the
     * list.
     *
     * @param index the index of the element to be removed
     * @return the element previously at the specified position
     * @throws IndexOutOfBoundsException if the index is out of range
     *                                   (<tt>index &lt; 0 || index &gt;= size()</tt>)
     */
    E remove(int index);

    /**
     * Removes all of the elements from this list.
     * The list will be empty after this call returns.
     */
    void clear();
    
    void sort();

}
